package com.huilan.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author ghy
 * @since 2019-04-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("T_USER")
@ApiModel(value="用户信息")
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @ApiModelProperty("ID")
    @TableId(value = "USER_ID", type = IdType.AUTO)
    private Integer userId;

    /**
     * 用户名
     */
    @ApiModelProperty("用户名")
    @TableField("USERNAME")
    private String username;

    /**
     * 邮件地址
     */
    @TableField("EMAIL")
    private String email;

    /**
     * 密码
     */
    @TableField("PASSWORD")
    private String password;

    /**
     * 创建人
     */
    @TableField("CREATER")
    private String creater;

    /**
     * 创建时间
     */
    @TableField("CREATE_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;


    public static final String USER_ID = "USER_ID";

    public static final String USERNAME = "USERNAME";

    public static final String FIRST_NAME = "FIRST_NAME";

    public static final String LAST_NAME = "LAST_NAME";

    public static final String EMAIL_ADDRESS = "EMAIL_ADDRESS";

    public static final String PASSWORD = "PASSWORD";

    public static final String PIN = "PIN";

    public static final String PIN_STATE = "PIN_STATE";

    public static final String CREATER = "CREATER";

    public static final String CREATE_TIME = "CREATE_TIME";

    @Override
    protected Serializable pkVal() {
        return this.userId;
    }

}
